<?php
include 'includes/query.php';
include 'includes/db.php';
$username = $_POST['user'];
$password = hash('sha256', $_POST['pass']);
if (queryuser($username) == "yes") {
    echo '用户存在<br><a href="reg.html">返回</a>';
} else {
    $sql = "insert into users (username, password) values ('$username','$password')";
    $result = $conn->query($sql);
    header("Location:index.html");
}
?>
